xlv.obj.checkbox={
	extend:function(){
	},
	implement:function(){
		this.implement('xlv.imp.mvc');
		this.implement('xlv.imp.editor');		
	},
	create:function(tag){
		var div=document.createElement((tag||'div'));
		div.setAttribute('xlvobject','xlv.obj.checkbox');
		return div;			
	},
	properties:{
		dmName:null,
		dmPath:null,
		text:null,
		htmlText:false,
		valueForChecked:'',
		valueForUnchecked:''
	},
	method:{
		construct:function(){
			var v=this.$V;
			v.editor=xlv.util.isTag(this,'input')?this:xlv.util.findDirectChild(this,{tag:'input',type:'checkbox'});
			if(!v.editor){
				var id=''+(new Date().getTime())+xlv.util.autoIncInteger();
				v.editor=document.createElement('input');
				v.editor.setAttribute('type','checkbox');
				v.editor.setAttribute('id', id);
				var lbl=document.createElement('label');
				lbl.setAttribute('for', id);
				if(this.$P.htmlText) lbl.innerHTML=this.$P.text;
				else xlv.util.setElementValue(lbl,this.$P.text);
				this.styleFor(v.editor);
				this.appendChild(v.editor);
				this.appendChild(lbl);
			}
		},
		initial:function(){
			if(Prototype.Browser.IE) this.addEventHandler('click', '_change',this.$V.editor);
			else this.addEventHandler('change', '_change',this.$V.editor);
		},
		styleFor:function(editor){
		},
		_change:function(event){
			var dm=this.mvc_getModel();
			if(dm)this.mvc_valueToModel(this.mvc_valueFromView(),dm);
		},
		isChecked:function(value){
			return value==this.$P.valueForChecked;
		},
		/**mvc imp*/
		mvc_valueFromView:function(){
			return this.editor_valueFromEditor();
		},
		mvc_valueToView:function(value){
			this.editor_valueToEditor(value);
		},
		/**editor imp*/
		editor_valueToEditor:function(value){
			this.$V.editor.value=value;
			this.$V.editor.checked=this.isChecked(value);
		},
		editor_valueFromEditor:function(){
			return this.$V.editor.checked ? this.$P.valueForChecked : this.$P.valueForUnchecked;
		}
	}
};
